package com.penghaisoft.microwms.common.page;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.io.Serializable;

/**
 * 翻页
 * @author zxcq0
 *
 */
@JsonIgnoreProperties(value = {"startIndex","pageSize","currentPage"})
public class Pagination implements Serializable{

	/**
	 * 当前页号，从1开始
	 */
	private int currentPage;
	
	/**
	 * 起始编号 limit startIndex,pageSize
	 */
	private int startIndex;
	
	/**
	 * 每页条数
	 */
	private int pageSize;

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
		if (this.pageSize > 0){
			setStartIndex((currentPage - 1) * this.pageSize);
		}
	}

	public int getStartIndex() {
		return startIndex;
	}

	public void setStartIndex(int startIndex) {
		this.startIndex = startIndex;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
}
